package com.xuyiwei.mayi.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by xuyiwei on 2019/5/5.
 */
public class AlipayConfig {

    // ↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016093000630956";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCasB1fDTkaZcZthckN0nxSaQzi7HOkCcOefOmPh2tdmXI2U0xOi4j19oFz4W2NjQfg+9N3sn3/OYZknYR9LlpfCmuuOVXElqkDu6Et3xjxXk1LxrA3Rey2PxJgJeO5NBHAigIvL1EN0RTcpFUyQSVi765eukrEMFeyz4m6Bc09CaQMHr2p8Cu5UHARhZIioWwduyT0pjBQTeL2jigyQtZqj8RthIzsormxy0xNt++5VfsU0gkb5y8SzWvQo9Xc5/HNMOvJ/L2BuSgs2d+wEZtGNJ8HHKnC3TIMbGLdMjeQvUvPYkMydo14OscdDgfGZ0IH5kjJLNcZYJb1/sRzzUvnAgMBAAECggEAPoIabFWYlK054PomA7rh2B9xQKXSGSCE9x989i3/2ePu/jrs4/SI1PPW3e/jaEbsPyMkEgOD3MXvI+tvJXK8vBkm6FFs8jL7e3GvsSytFKRJ0ewpOzy7ae3UzBujiSycW9SpC04wj8fEiWCyuMsQg4ldShQ3sE3ksnIhMpWzmQ0QEaKf26va/RGGQRSu76Je9ZnMrOHB2XEoDgh6i3jg2qnvaXiKjETpCGOwNocfsFufhdlmQ4MtSp0Ln9cwvkdRT5d7tJ8nThVSEutI9ptQlTGbmIcuvpEutQLXaxt51sfwCqLSSc4zur+y6YHssmy/MIIwltEdd9LXHdXKmAjWeQKBgQDsWIrMIJPOY0qzKBZAnjZ8LAvwN+UE+IanafJY0TQ+4LavBxiK2tnwIN6N+u5TrS0IkGOlKb9UaKQT7KSW0KjptEgp1R3OcdHX/PhDnQu5Q3rfVVNB6pthYaxTWwFCzmRgalFd73Wo1jev1cHAKn5IVV04v6JDgtoEcoH6MNQxJQKBgQCnjTHkACCNFHphpNJy82z9kwCp4UfHbV0ZM7qco8WJ2GkJnNNrxAMkPtHOeWIHsxRUZYIyNlRtu+puUXQZk1100XSypMZhpb+ytNxmiDy6rCPjzriQVykfv1Wx78NPAP0qgxKHqfKjrv/z27DyC/htIhp3ZGtwDeK2+CxybsmZGwKBgBAR1R4b+PDHf4S+7QRnvXyj4gvrQP8dhspLQdcYIl1EGie8a8bFKpxRH9C3hwzZcX5rktrgA8pRcxaHuIkoltONFnsBqo0m4AW3hYnTW8C0/d3Bh2+r6/SrF3Rzc5p/PgPwNqgUaAOazR5/gjT2rq9sXnJFVVsRwpEa2AuS1lqhAoGACR82yCL5orSqtQY0Lu3x0RxfvN/2+HSLzQNz9XM1HfwaO9u95vAU+7Qv1/3jyGeHg9DC9djfX9oLOVZV686KGAIPSGqQImDTvvb5yNtB8yfMDGsEwVb9di0EjVtwVqzHG7lnGNu3yhGM/cnIKGVecRKaPkXJU6Bt52g7gz9k2mECgYAMDl9Atc4ksnDbBN1tAL5V41zobtOyVkFh93SqpHKlFf8c3MVLeTMSzBfCm84H8DAD8fF0/013+LkkFbgcJrokh3cZAJ60boKr97vqyVpgKEVZj6VhjgeJZTMDnNR8QfLBAk+D9GpWUdsOR+ZXeYExL1/vot92naXEH23vvtLmzw==";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm
    // 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApsRnb26CpGcfKXZ2/JhWhI92R2ssIhHTnkD5rDtFGNvEgchBYGZSMJo9+JyJJmU3VVSwf6MAWsIYOBlAbQR5XwMfNd2QY75gLD5MQp7WnlbRsP3O8cMMlLSlbm2uEevk6nhLDztmAAlCPZIU8DIyUB5GHbxGsBhW6FJqgYx2nxToW+CrSODrqohaJ6FPrF9xn+E1yKmE0f1CpmH3RXW2Q3v6a5SkxoAekpCejQ6xA6YFATAsR+RINoA4c+duJw84yPlwiwkziTuDn6zFneIGkowbTYHwfPwdSzRVGHXvuvvXkWgolqJSuyM0cijl8BQ3uFznxSQ0lAA21mkvNxACDwIDAQAB";
    // 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://itxywtest.natapp1.cc/alibaba/callBack/notifyUrl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://itxywtest.natapp1.cc/alibaba/callBack/returnUrl";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";

    // ↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord
     *            要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}